#include <interfacelib/window/tooltip.h>

using namespace interfacelib::Window;

Tooltip::Tooltip()
{
}

Tooltip::~Tooltip()
{
}

bool Tooltip::create(const char *filename, int x, int y, DWORD attribute )
{
	bool result = Window::create( filename, x, y, attribute );

	m_style.format = DT_NOCLIP | DT_CENTER;

	setMultiLine( true );
	setReadOnly( true );
	setResize( true );

	return ( result );
}
void Tooltip::setTooltip( int x, int y, char *tooltip )
{
	if ( !tooltip )
	{
		setVisible( false );
		return;
	}
	clear();
	setVisible( true );
	setString( tooltip );

	SIZE totalLineSize = { 0 , 0 };
	getTotalLineSize( &totalLineSize );

	setWindowPos( x, y, totalLineSize.cx + ( m_tooltipMargin.x * 2 ), totalLineSize.cy + ( m_tooltipMargin.y * 2 ) );
}